package com.example.spareparts.repository;

import org.apache.ibatis.annotations.*;
import java.util.List;
import com.example.spareparts.entity.SupplierEvaluations;

@Mapper
public interface SupplierEvaluationsRepository {
    @Select("SELECT * FROM SupplierEvaluations")
    List<SupplierEvaluations> findAllSupplierEvaluations();
    @Insert("INSERT INTO SupplierEvaluations (supplier_id, delivery_timeliness, quality_score) VALUES (#{supplierid}, #{deliveryTimeliness}, #{qualityScore})")
    @Options(useGeneratedKeys = true, keyProperty = "evaluationid")
    void insertSupplierEvaluations(SupplierEvaluations supplierEvaluations);
    @Update("UPDATE SupplierEvaluations SET evaluation_id= #{evaluationid}, supplier_id= #{supplierid}, delivery_timeliness= #{deliveryTimeliness}, quality_score= #{qualityScore} WHERE evaluation_id= #{evaluationid}")
    void updateSupplierEvaluations(SupplierEvaluations supplierEvaluations);
    @Delete("DELETE FROM SupplierEvaluations WHERE evaluation_id= #{evaluationid}")
    void deleteSupplierEvaluations(Long evaluationid);

    @Select("SELECT * FROM SupplierEvaluations WHERE evaluation_id= #{evaluationid}")
    SupplierEvaluations findSupplierEvaluationsById(Long evaluationid);
    @Select("SELECT * FROM SupplierEvaluations WHERE supplier_id= #{supplierid}")
    List<SupplierEvaluations> findSupplierEvaluationsBySupplierId(Long supplierid);

}
